<extend name="Layout:layout" />
<block name="head_after">
    <script type="text/javascript" src="__THEME__js/action.js"></script>
    <script type="text/javascript" src="__THEME__js/mzp-packed-me.js"></script>
</block>
<block name="body_main">
    <div class="block box">
        <div class="blank"></div>
        <div id="ur_here">
            当前位置: <a href="{:U('EShop/Index/index')}">首页</a>
            <foreach name="abreadcrumb" item="vo">
                &nbsp;&gt;&nbsp;<a href="{:U('products','cid='.$vo['id'])}">{$vo.title}</a>
            </foreach>
        </div>
    </div>
    <div class="blank"></div>
    <div class="block clearfix">
        <div class="AreaL">
            <div id="category_tree">
                <div class="tit">所有商品分类</div>
                <dl class="clearfix" >
                    <div class="box1 cate" id="cate">
                        <product_category:get_tree remark="页面顶部商品二级分类">
                            <h1 onclick="tab({$key})">		 		
                                <span class="f_l"><img src="__THEME__images/btn_fold.gif" style="padding-top:10px;padding-right:6px;cursor:pointer;"></span>
                                <a href="{:U('products','cid='.$vo['id'])}" class="f_l">{$vo.title}</a>
                            </h1>
                            <if condition="$vo['children']">
                                <ul style="display:none" >
                                    <foreach name="vo['children']" item="vo2">
                                        <a class="over_2" href="{:U('products','cid='.$vo2['id'])}">{$vo2.title}</a>
                                        <div class="clearfix"></div>
                                    </foreach>
                                </ul>
                            </if>
                            <div style="clear:both"></div>
                        </product_category:get_tree>
                    </div>
                    <div style="clear:both"></div>  
            </div>
            <div class="blank"></div>
            <script type="text/javascript">
                obj_h4 = document.getElementById("cate").getElementsByTagName("h4")
                obj_ul = document.getElementById("cate").getElementsByTagName("ul")
                obj_img = document.getElementById("cate").getElementsByTagName("img")
                function tab(id)
                {
                    if (obj_ul.item(id).style.display == "block")
                    {
                        obj_ul.item(id).style.display = "none"
                        obj_img.item(id).src = "__THEME__images/btn_fold.gif"
                        return false;
                    } else
                        (obj_ul.item(id).style.display == "none")
                    {
                        obj_ul.item(id).style.display = "block"
                        obj_img.item(id).src = "__THEME__images/btn_unfold.gif"
                    }
                }
            </script>
            <div class="box" id='history_div'> <div class="box_1">
                    <h3><span>浏览历史</span></h3>
                    <div class="boxCenterList clearfix" id='history_list'>
                    </div>
                </div>
            </div>
            <div class="blank5"></div>
            <script type="text/javascript">
                if (document.getElementById('history_list').innerHTML.replace(/\s/g, '').length < 1)
                {
                    document.getElementById('history_div').style.display = 'none';
                } else
                {
                    document.getElementById('history_div').style.display = 'block';
                }
                function clear_history()
                {
                    Ajax.call('user.php', 'act=clear_history', clear_history_Response, 'GET', 'TEXT', 1, 1);
                }
                function clear_history_Response(res)
                {
                    document.getElementById('history_list').innerHTML = '您已清空最近浏览过的商品';
                }
            </script>  
        </div>
        <div class="AreaR">
            <div id="goodsInfo" class="clearfix">
                <div class="imgInfo">
                    <a href="{$data.picture_url}" id="zoom1" class="MagicZoom MagicThumb" title="{$data.title}">
                        <img src="{$data.picture_url}" alt="{$data.title}" width="360px;" height="360px"/>
                    </a>
                    <div class="blank5"></div>
                    <div style="text-align:center; position:relative; width:100%;">
                        <a href="goods.php?id=96"><img style="position: absolute; left:0;" alt="prev" src="__THEME__images/up.gif" /></a>
                        <a href="{$data.picture_url}" target="_blank"><img alt="zoom" src="__THEME__images/zoom.gif" /></a>
                        <a href="goods.php?id=94"><img style="position: absolute;right:0;"  alt="next" src="__THEME__images/down.gif" /></a>
                    </div>
                    <div class="blank"></div>
                    <div class="picture" id="imglist">
                        <!--
                        <a  href="__THEME__images/95_P_1460424620716.jpg"
                            rel="zoom1" 
                            rev="__THEME__images/95_P_1460424620716.jpg"
                            title="">
                            <img src="__THEME__images/95_thumb_P_1460424620892.jpg" alt="孚日家纺提花染色四件套炫蓝意韵" class="onbg" /></a>
                        -->                        
                        <foreach name="thumbs" item="vo">
                            <a  href="{$vo.file_path}" rel="zoom1" rev="{$vo.file_path}" title="{$vo.title}">
                                <img src="{$vo.file_path}" alt="{$vo.title}" class="autobg" />
                            </a>
                        </foreach>
                    </div>
                    <script type="text/javascript">
                        mypicBg();
                    </script>     

                </div>

                <div class="textInfo">
                    <form action="javascript:addToCart(95)" method="post" name="ECS_FORMBUY" id="ECS_FORMBUY" >
                        <h1 class="clearfix" >{$data.title}</h1> 
                        <ul class="ul2 clearfix">
                            <li class="clearfix" style="width:100%">
                            <dd>
                                <strong>本店售价：</strong><font class="shop" id="ECS_SHOPPRICE" data-value="{$data.price}">￥{$data.price}元</font> 
                                <font class="market">￥{$data.market_price}元</font> 
                            </dd>
                            </li>
                            <li class="clearfix">
                            <dd>
                                <strong>商品货号：</strong>{$data.marque}     
                            </dd>
                            </li> 
                            <li class="clearfix">
                            <dd>
                                <strong>商品库存：</strong>{$data.stock}
                            </dd>
                            </li>
                        </ul>
                        <ul>
                            <li class="clearfix">
                            <dd >
                                <a href="{:U('add_favorite','pid='.$data['id'])}" id="lnk-favorite">收藏</a>
                                <script type='text/javascript'>
                                    jQuery('#lnk-favorite').click(function () {
                                        var $a = jQuery(this);
                                        jQuery.get($a.attr('href'), function (msg) {
                                            if (msg.status) {
                                                alert('收藏成功!');
                                            } else {
                                                alert(msg.info);
                                            }
                                        })
                                        return false;
                                    })
                                </script>
                            </dd>
                            </li>
                            <li style="height:30px;padding-top:4px;">
                                此商品为免运费商品，计算配送金额时将不计入配送费用<br />
                            </li>
                        </ul>
                        <ul class="bnt_ul">
                            <li class="padd loop">
                                <strong>规格：</strong>
                                <label for="spec_value_641">
                                    <!--<input type="radio" name="spec_56" value="641" id="spec_value_641" checked onclick="changePrice()" />-->
                                    200*230cm [适合1.8米/2米床] </label>
                                <input type="hidden" name="spec_list" value="0" />
                            </li>
                            <!--
                            <li class="padd loop">
                                <strong>颜色：</strong>
                                <label for="spec_value_642">
                                    <input type="radio" name="spec_216" value="642" id="spec_value_642" checked onclick="changePrice()" />
                                    俏蓝 [ ￥0.00元] </label>
                                <input type="hidden" name="spec_list" value="0" />
                            </li>
                            <li class="padd loop">
                                <strong>材质：</strong>
                                <label for="spec_value_643">
                                    <input type="checkbox" name="spec_58" value="643" id="spec_value_643" onclick="changePrice()" />
                                    其它 [ ￥0.00元] </label>
                                <input type="hidden" name="spec_list" value="0" />
                            </li>
                            -->
                            <li class="clearfix">
                            <dd>
                                <strong>购买数量：</strong>
                                <input name="number" type="text" id="number" value="1" size="3" style="border:1px solid #ccc; "/>件，<strong>商品总价：</strong><font id="ECS_GOODS_AMOUNT" class="f1" style="font-size:13px;">{$data.price}</font> 元
                            </dd>
                            </li>

                            <li class="padd">
                                <a id="lnk-add-cart" href="{:U('Cart/add_cart','n=varn&pid='.$data['id'])}"><img src="__THEME__images/goumai2.gif" /></a>
                            </li>
                        </ul>
                    </form>
                    <script type="text/javascript">
                        jQuery('#number').change(function () {
                            var price=jQuery('#ECS_SHOPPRICE').data('value');
                            var num=jQuery(this).val();
                            var amount = price * num;
                            jQuery('#ECS_GOODS_AMOUNT').text(amount);
                        });
                        jQuery('#lnk-add-cart').click(function () {
                            var num = parseInt(jQuery('#number').val());
                            if (num < 1) {
                                alert('数量无效!');
                                return false;
                            }
                            var url = jQuery(this).attr('href');
                            url = url.replace('varn', num)
                            jQuery.get(url, function (msg) {
                                if (msg.status) {
                                    alert('加入购物车成功!');
                                    get_cart_count();
                                } else {
                                    alert(msg.info);
                                }
                            });
                            return false;
                        })
                    </script>
                </div>
            </div>
            <div class="blank"></div>
            <div class="box">
                <div style="padding:0 0px;">
                    <div id="com_b" class="history clearfix">
                        <h2>商品描述</h2>
                        <h2 class="h2bg">商品属性</h2>
                        <!--
                        <h2 class="h2bg">相关商品</h2>
                        -->
                    </div>
                </div>    
                <div class="box_1">
                    <div id="com_v" style="padding:6px;"></div>
                    <div id="com_h">
                        <blockquote title="商品描述">
                            {$data.description}
                        </blockquote>
                        <blockquote title="商品属性">
                            {$data.attr_table}
                        </blockquote>
                    </div>
                </div>
            </div>
            <script type="text/javascript">
                reg("com");
            </script>
            <div class="blank"></div>            
            <div class="blank5"></div>
        </div>
    </div>
</block>